package com.plian.system.service.sys.bigdata.BulletinService;

import com.alibaba.fastjson.JSONObject;
import com.plian.Tools.pagedata.PageData;
import com.plian.system.dao.fr.bulletin.BulletinDao;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author huzb
 * @create 2020-10-21 15:34
 */
@Slf4j
@Service
@AllArgsConstructor
public class BulletinfoService {

    BulletinDao bulletinDao;

    /**
     *
     * @param json
     * @return
     */
    public List<PageData> findListByDateRange(String json)  {
        List<PageData> listByDateRange = new ArrayList<>();
        try {
            PageData pageData = new PageData();
            JSONObject jsonObject = JSONObject.parseObject(json);
            String starttime = jsonObject.getString("startTime");
            String endtime = jsonObject.getString("endTime");
            pageData.put("startTime",starttime);
            pageData.put("endTime",endtime);
            listByDateRange= bulletinDao.findListByDateRange(pageData);
            //System.out.println(listByDateRange);
        } catch (Exception e) {
            log.error(ExceptionUtils.getFullStackTrace(e));
        }
        return listByDateRange;
    }
}
